/*
 * Amazon Ads API - Sponsored Products
 * Use the Amazon Ads API for Sponsored Products for campaign, ad group, keyword, negative keyword, and product ad management operations. For more information about Sponsored Products, see the [Sponsored Products Support Center](https://advertising.amazon.com/help?entityId=ENTITY3CWETCZD9HEG2#GWGFKPEWVWG2CLUJ). For onboarding information, see the [account setup](setting-up/account-setup) topic.<br/><br/> 
 *
 * The version of the OpenAPI document: 2.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.client.api;

import org.openapitools.client.ApiCallback;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import org.openapitools.client.ProgressRequestBody;
import org.openapitools.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import java.math.BigDecimal;
import org.openapitools.client.model.CreateKeyword;
import org.openapitools.client.model.Error;
import org.openapitools.client.model.Keyword;
import org.openapitools.client.model.KeywordEx;
import org.openapitools.client.model.KeywordResponse;
import org.openapitools.client.model.UpdateKeyword;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class KeywordsApi {
    private ApiClient localVarApiClient;

    public KeywordsApi() {
        this(Configuration.getDefaultApiClient());
    }

    public KeywordsApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    /**
     * Build call for archiveKeyword
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call archiveKeywordCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/keywords/{keywordId}"
            .replaceAll("\\{" + "keywordId" + "\\}", localVarApiClient.escapeString(keywordId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call archiveKeywordValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling archiveKeyword(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling archiveKeyword(Async)");
        }
        
        // verify the required parameter 'keywordId' is set
        if (keywordId == null) {
            throw new ApiException("Missing the required parameter 'keywordId' when calling archiveKeyword(Async)");
        }
        

        okhttp3.Call localVarCall = archiveKeywordCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, _callback);
        return localVarCall;

    }

    /**
     * Archives a keyword.
     * Set the status of the specified keyword to &#x60;archived&#x60;. Note that once the status for a keyword is set to &#x60;archived&#x60; it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @return KeywordResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public KeywordResponse archiveKeyword(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId) throws ApiException {
        ApiResponse<KeywordResponse> localVarResp = archiveKeywordWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId);
        return localVarResp.getData();
    }

    /**
     * Archives a keyword.
     * Set the status of the specified keyword to &#x60;archived&#x60;. Note that once the status for a keyword is set to &#x60;archived&#x60; it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @return ApiResponse&lt;KeywordResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<KeywordResponse> archiveKeywordWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId) throws ApiException {
        okhttp3.Call localVarCall = archiveKeywordValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, null);
        Type localVarReturnType = new TypeToken<KeywordResponse>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Archives a keyword. (asynchronously)
     * Set the status of the specified keyword to &#x60;archived&#x60;. Note that once the status for a keyword is set to &#x60;archived&#x60; it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call archiveKeywordAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, final ApiCallback<KeywordResponse> _callback) throws ApiException {

        okhttp3.Call localVarCall = archiveKeywordValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, _callback);
        Type localVarReturnType = new TypeToken<KeywordResponse>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for createKeywords
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createKeyword An array of keyword objects. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createKeywordsCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateKeyword> createKeyword, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = createKeyword;

        // create path and map variables
        String localVarPath = "/v2/sp/keywords";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call createKeywordsValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateKeyword> createKeyword, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling createKeywords(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling createKeywords(Async)");
        }
        

        okhttp3.Call localVarCall = createKeywordsCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createKeyword, _callback);
        return localVarCall;

    }

    /**
     * Creates one or more keywords.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createKeyword An array of keyword objects. (optional)
     * @return List&lt;KeywordResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<KeywordResponse> createKeywords(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateKeyword> createKeyword) throws ApiException {
        ApiResponse<List<KeywordResponse>> localVarResp = createKeywordsWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createKeyword);
        return localVarResp.getData();
    }

    /**
     * Creates one or more keywords.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createKeyword An array of keyword objects. (optional)
     * @return ApiResponse&lt;List&lt;KeywordResponse&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<KeywordResponse>> createKeywordsWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateKeyword> createKeyword) throws ApiException {
        okhttp3.Call localVarCall = createKeywordsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createKeyword, null);
        Type localVarReturnType = new TypeToken<List<KeywordResponse>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Creates one or more keywords. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createKeyword An array of keyword objects. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createKeywordsAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateKeyword> createKeyword, final ApiCallback<List<KeywordResponse>> _callback) throws ApiException {

        okhttp3.Call localVarCall = createKeywordsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createKeyword, _callback);
        Type localVarReturnType = new TypeToken<List<KeywordResponse>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getKeyword
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getKeywordCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/keywords/{keywordId}"
            .replaceAll("\\{" + "keywordId" + "\\}", localVarApiClient.escapeString(keywordId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (locale != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("locale", locale));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getKeywordValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling getKeyword(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling getKeyword(Async)");
        }
        
        // verify the required parameter 'keywordId' is set
        if (keywordId == null) {
            throw new ApiException("Missing the required parameter 'keywordId' when calling getKeyword(Async)");
        }
        

        okhttp3.Call localVarCall = getKeywordCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale, _callback);
        return localVarCall;

    }

    /**
     * Gets a keyword specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @return Keyword
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public Keyword getKeyword(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale) throws ApiException {
        ApiResponse<Keyword> localVarResp = getKeywordWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale);
        return localVarResp.getData();
    }

    /**
     * Gets a keyword specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @return ApiResponse&lt;Keyword&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Keyword> getKeywordWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale) throws ApiException {
        okhttp3.Call localVarCall = getKeywordValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale, null);
        Type localVarReturnType = new TypeToken<Keyword>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets a keyword specified by identifier. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getKeywordAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale, final ApiCallback<Keyword> _callback) throws ApiException {

        okhttp3.Call localVarCall = getKeywordValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale, _callback);
        Type localVarReturnType = new TypeToken<Keyword>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getKeywordEx
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getKeywordExCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/keywords/extended/{keywordId}"
            .replaceAll("\\{" + "keywordId" + "\\}", localVarApiClient.escapeString(keywordId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (locale != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("locale", locale));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getKeywordExValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling getKeywordEx(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling getKeywordEx(Async)");
        }
        
        // verify the required parameter 'keywordId' is set
        if (keywordId == null) {
            throw new ApiException("Missing the required parameter 'keywordId' when calling getKeywordEx(Async)");
        }
        

        okhttp3.Call localVarCall = getKeywordExCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale, _callback);
        return localVarCall;

    }

    /**
     * Gets a keyword with extended data fields.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @return KeywordEx
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public KeywordEx getKeywordEx(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale) throws ApiException {
        ApiResponse<KeywordEx> localVarResp = getKeywordExWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale);
        return localVarResp.getData();
    }

    /**
     * Gets a keyword with extended data fields.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @return ApiResponse&lt;KeywordEx&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<KeywordEx> getKeywordExWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale) throws ApiException {
        okhttp3.Call localVarCall = getKeywordExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale, null);
        Type localVarReturnType = new TypeToken<KeywordEx>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets a keyword with extended data fields. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param keywordId The identifier of an existing keyword. (required)
     * @param locale The locale preference of the advertiser. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getKeywordExAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal keywordId, String locale, final ApiCallback<KeywordEx> _callback) throws ApiException {

        okhttp3.Call localVarCall = getKeywordExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, keywordId, locale, _callback);
        Type localVarReturnType = new TypeToken<KeywordEx>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listKeywords
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listKeywordsCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/keywords";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (startIndex != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("startIndex", startIndex));
        }

        if (count != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("count", count));
        }

        if (matchTypeFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("matchTypeFilter", matchTypeFilter));
        }

        if (keywordText != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("keywordText", keywordText));
        }

        if (stateFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("stateFilter", stateFilter));
        }

        if (campaignIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignIdFilter", campaignIdFilter));
        }

        if (adGroupIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adGroupIdFilter", adGroupIdFilter));
        }

        if (keywordIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("keywordIdFilter", keywordIdFilter));
        }

        if (locale != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("locale", locale));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listKeywordsValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling listKeywords(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling listKeywords(Async)");
        }
        

        okhttp3.Call localVarCall = listKeywordsCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale, _callback);
        return localVarCall;

    }

    /**
     * 
     * Gets a list of keywords.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @return List&lt;Keyword&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<Keyword> listKeywords(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale) throws ApiException {
        ApiResponse<List<Keyword>> localVarResp = listKeywordsWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale);
        return localVarResp.getData();
    }

    /**
     * 
     * Gets a list of keywords.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @return ApiResponse&lt;List&lt;Keyword&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<Keyword>> listKeywordsWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale) throws ApiException {
        okhttp3.Call localVarCall = listKeywordsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale, null);
        Type localVarReturnType = new TypeToken<List<Keyword>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * Gets a list of keywords.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listKeywordsAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale, final ApiCallback<List<Keyword>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listKeywordsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale, _callback);
        Type localVarReturnType = new TypeToken<List<Keyword>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listKeywordsEx
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listKeywordsExCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/keywords/extended";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (startIndex != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("startIndex", startIndex));
        }

        if (count != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("count", count));
        }

        if (matchTypeFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("matchTypeFilter", matchTypeFilter));
        }

        if (keywordText != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("keywordText", keywordText));
        }

        if (stateFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("stateFilter", stateFilter));
        }

        if (campaignIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignIdFilter", campaignIdFilter));
        }

        if (adGroupIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adGroupIdFilter", adGroupIdFilter));
        }

        if (keywordIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("keywordIdFilter", keywordIdFilter));
        }

        if (locale != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("locale", locale));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listKeywordsExValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling listKeywordsEx(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling listKeywordsEx(Async)");
        }
        

        okhttp3.Call localVarCall = listKeywordsExCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale, _callback);
        return localVarCall;

    }

    /**
     * Gets a list of keywords that have extended data fields.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @return List&lt;KeywordEx&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<KeywordEx> listKeywordsEx(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale) throws ApiException {
        ApiResponse<List<KeywordEx>> localVarResp = listKeywordsExWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale);
        return localVarResp.getData();
    }

    /**
     * Gets a list of keywords that have extended data fields.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @return ApiResponse&lt;List&lt;KeywordEx&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<KeywordEx>> listKeywordsExWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale) throws ApiException {
        okhttp3.Call localVarCall = listKeywordsExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale, null);
        Type localVarReturnType = new TypeToken<List<KeywordEx>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets a list of keywords that have extended data fields. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param matchTypeFilter Restricts results to keywords with match types within the specified comma-separated list. For more information, see [match types](https://advertising.amazon.com/help#GHTRFDZRJPW6764R) in the Amazon Ads support center. (optional)
     * @param keywordText Restricts results to keywords that match the specified text exactly. (optional)
     * @param stateFilter Restricts results to resources with state within the specified comma-separated list. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param keywordIdFilter Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list. (optional)
     * @param locale Restricts results to keywords associated with locale. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listKeywordsExAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String matchTypeFilter, String keywordText, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String keywordIdFilter, String locale, final ApiCallback<List<KeywordEx>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listKeywordsExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, matchTypeFilter, keywordText, stateFilter, campaignIdFilter, adGroupIdFilter, keywordIdFilter, locale, _callback);
        Type localVarReturnType = new TypeToken<List<KeywordEx>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for updateKeywords
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateKeyword An array of update keyword objects. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateKeywordsCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateKeyword> updateKeyword, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = updateKeyword;

        // create path and map variables
        String localVarPath = "/v2/sp/keywords";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateKeywordsValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateKeyword> updateKeyword, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling updateKeywords(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling updateKeywords(Async)");
        }
        

        okhttp3.Call localVarCall = updateKeywordsCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateKeyword, _callback);
        return localVarCall;

    }

    /**
     * Updates one or more keywords.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateKeyword An array of update keyword objects. (optional)
     * @return List&lt;KeywordResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<KeywordResponse> updateKeywords(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateKeyword> updateKeyword) throws ApiException {
        ApiResponse<List<KeywordResponse>> localVarResp = updateKeywordsWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateKeyword);
        return localVarResp.getData();
    }

    /**
     * Updates one or more keywords.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateKeyword An array of update keyword objects. (optional)
     * @return ApiResponse&lt;List&lt;KeywordResponse&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<KeywordResponse>> updateKeywordsWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateKeyword> updateKeyword) throws ApiException {
        okhttp3.Call localVarCall = updateKeywordsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateKeyword, null);
        Type localVarReturnType = new TypeToken<List<KeywordResponse>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Updates one or more keywords. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateKeyword An array of update keyword objects. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateKeywordsAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateKeyword> updateKeyword, final ApiCallback<List<KeywordResponse>> _callback) throws ApiException {

        okhttp3.Call localVarCall = updateKeywordsValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateKeyword, _callback);
        Type localVarReturnType = new TypeToken<List<KeywordResponse>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
